Load Data

dataset <- read.delim("raw_data/FigureS5M.txt", stringsAsFactors = FALSE)

dataset$genotype <- gsub(" ", "", dataset$genotype )
dataset$genotype <- factor(dataset$genotype)
dataset$Experiment <- factor(rep(paste0("exp", 1:(length(dataset$genotype)/length(levels(dataset$genotype)))), each=length(unique(dataset$genotype))))

dataset$UID <- factor(paste(dataset$Experiment, dataset$genotype))

# wide format
kable(dataset, row.names = F)
genotype NT etoposide_5uM etoposide_10uM etoposide_25uM Experiment UID
WT 1792 1042 756 468 exp1 exp1 WT
YFP-ALC1 2284 1524 1212 510 exp1 exp1 YFP-ALC1
WT 1612 654 404 119 exp2 exp2 WT
YFP-ALC1 1262 983 570 183 exp2 exp2 YFP-ALC1
WT 1298 884 686 236 exp3 exp3 WT
YFP-ALC1 1512 1229 880 363 exp3 exp3 YFP-ALC1
library(reshape2)
# reshape to long format
dataset <- melt(dataset, variable.name = "Treatment", value.name = "Counts")

dataset$genotype <- relevel(dataset$genotype, ref = "WT")
dataset$UID <- relevel(dataset$UID, ref = "exp1 WT")

dataset$Etoposide <- gsub("NT","1",dataset$Treatment)
dataset$Etoposide <- gsub("etoposide_|uM","",dataset$Etoposide)
dataset$Etoposide <- log10(as.integer(dataset$Etoposide))




dataset$Offset <- NA
for(uid in levels(dataset$UID)){
        dataset$Offset[dataset$UID == uid] <- mean(dataset$Counts[dataset$UID == uid])
}

dataset$NormCounts <- dataset$Counts / dataset$Offset



dataset$Offset2 <- NA
for(gid in levels(dataset$genotype)){
        dataset$Offset2[dataset$genotype == gid] <- mean(dataset$NormCounts[dataset$genotype == gid & dataset$Etoposide == 0])
}

dataset$NormCounts2 <- dataset$NormCounts / dataset$Offset2



# long format
kable(dataset, row.names = F)
genotype Experiment UID Treatment Counts Etoposide Offset NormCounts Offset2 NormCounts2
WT exp1 exp1 WT NT 1792 0.00000 1014.50 1.7663874 1.917002 0.9214320
YFP-ALC1 exp1 exp1 YFP-ALC1 NT 2284 0.00000 1382.50 1.6520796 1.617980 1.0210752
WT exp2 exp2 WT NT 1612 0.00000 697.25 2.3119398 1.917002 1.2060181
YFP-ALC1 exp2 exp2 YFP-ALC1 NT 1262 0.00000 749.50 1.6837892 1.617980 1.0406735
WT exp3 exp3 WT NT 1298 0.00000 776.00 1.6726804 1.917002 0.8725499
YFP-ALC1 exp3 exp3 YFP-ALC1 NT 1512 0.00000 996.00 1.5180723 1.617980 0.9382514
WT exp1 exp1 WT etoposide_5uM 1042 0.69897 1014.50 1.0271069 1.917002 0.5357880
YFP-ALC1 exp1 exp1 YFP-ALC1 etoposide_5uM 1524 0.69897 1382.50 1.1023508 1.617980 0.6813129
WT exp2 exp2 WT etoposide_5uM 654 0.69897 697.25 0.9379706 1.917002 0.4892902
YFP-ALC1 exp2 exp2 YFP-ALC1 etoposide_5uM 983 0.69897 749.50 1.3115410 1.617980 0.8106038
WT exp3 exp3 WT etoposide_5uM 884 0.69897 776.00 1.1391753 1.917002 0.5942482
YFP-ALC1 exp3 exp3 YFP-ALC1 etoposide_5uM 1229 0.69897 996.00 1.2339357 1.617980 0.7626395
WT exp1 exp1 WT etoposide_10uM 756 1.00000 1014.50 0.7451947 1.917002 0.3887291
YFP-ALC1 exp1 exp1 YFP-ALC1 etoposide_10uM 1212 1.00000 1382.50 0.8766727 1.617980 0.5418315
WT exp2 exp2 WT etoposide_10uM 404 1.00000 697.25 0.5794191 1.917002 0.3022527
YFP-ALC1 exp2 exp2 YFP-ALC1 etoposide_10uM 570 1.00000 749.50 0.7605070 1.617980 0.4700348
WT exp3 exp3 WT etoposide_10uM 686 1.00000 776.00 0.8840206 1.917002 0.4611473
YFP-ALC1 exp3 exp3 YFP-ALC1 etoposide_10uM 880 1.00000 996.00 0.8835341 1.617980 0.5460722
WT exp1 exp1 WT etoposide_25uM 468 1.39794 1014.50 0.4613110 1.917002 0.2406418
YFP-ALC1 exp1 exp1 YFP-ALC1 etoposide_25uM 510 1.39794 1382.50 0.3688969 1.617980 0.2279984
WT exp2 exp2 WT etoposide_25uM 119 1.39794 697.25 0.1706705 1.917002 0.0890299
YFP-ALC1 exp2 exp2 YFP-ALC1 etoposide_25uM 183 1.39794 749.50 0.2441628 1.617980 0.1509059
WT exp3 exp3 WT etoposide_25uM 236 1.39794 776.00 0.3041237 1.917002 0.1586454
YFP-ALC1 exp3 exp3 YFP-ALC1 etoposide_25uM 363 1.39794 996.00 0.3644578 1.617980 0.2252548

Plot Data

library(ggplot2)

# raw data
ggplot(dataset, aes(x=Etoposide, y=Counts)) + 
        theme_bw() +
        theme(panel.grid=element_blank(), text = element_text(size=14)) +
        geom_smooth(method=lm, formula = y ~ poly(x,2), se=FALSE, aes(colour=genotype)) +
        geom_point(aes(colour=genotype, shape=Experiment), size=2) +        
        #facet_grid(. ~ genotype) +
        xlab(label = "Etoposide (log10 µM)") +
        scale_shape_manual(values=15:20) +
        scale_color_manual(values=c("#000000","#808000"))

# NormCounts Linear
ggplot(dataset, aes(x=Etoposide, y=NormCounts, color=genotype)) + 
        theme_bw() +
        theme(panel.grid=element_blank(), text = element_text(size=14)) +
        geom_point(aes(colour=genotype), size=2) +        
        geom_smooth(method=lm, formula = y ~ x, se=FALSE) +
        #facet_grid(. ~ genotype) +
        xlab(label = "Etoposide (log10 µM)") +
        scale_color_manual(values=c("#000000","#808000"))

# NormCounts2 Linear
ggplot(dataset, aes(x=Etoposide, y=NormCounts2, color=genotype)) + 
        theme_bw() +
        theme(panel.grid=element_blank(), text = element_text(size=14)) +
        geom_point(aes(colour=genotype), size=2) +        
        geom_smooth(method=lm, formula = y ~ x, se=FALSE) +
        #facet_grid(. ~ genotype) +
        xlab(label = "Etoposide (log10 µM)") +
        scale_color_manual(values=c("#000000","#808000"))

# NormCounts Quadratic
ggplot(dataset, aes(x=Etoposide, y=NormCounts, color=genotype)) + 
        theme_bw() +
        theme(panel.grid=element_blank(), text = element_text(size=14)) +
        geom_point(aes(colour=genotype), size=2) +        
        geom_smooth(method=lm, formula = y ~ poly(x,2), se=FALSE) +
        #facet_grid(. ~ genotype) +
        xlab(label = "Etoposide (log10 µM)")+
        scale_color_manual(values=c("#000000","#808000"))

# NormCounts2 Quadratic
ggplot(dataset, aes(x=Etoposide, y=NormCounts2, color=genotype)) + 
        theme_bw() +
        theme(panel.grid=element_blank(), text = element_text(size=14)) +
        geom_point(aes(colour=genotype), size=2) +        
        geom_smooth(method=lm, formula = y ~ poly(x,2), se=FALSE) +
        #facet_grid(. ~ genotype) +
        xlab(label = "Etoposide (log10 µM)") +
        scale_color_manual(values=c("#000000","#808000"))

# NormCounts Cubic
ggplot(dataset, aes(x=Etoposide, y=NormCounts, color=genotype)) + 
        theme_bw() +
        theme(panel.grid=element_blank(), text = element_text(size=14)) +
        geom_point(aes(colour=genotype), size=2) +        
        geom_smooth(method=lm, formula = y ~ poly(x,3), se=FALSE) +
        #facet_grid(. ~ genotype) +
        xlab(label = "Etoposide (log10 µM)")+
        scale_color_manual(values=c("#000000","#808000"))

# NormCounts2 Cubic
ggplot(dataset, aes(x=Etoposide, y=NormCounts2, color=genotype)) + 
        theme_bw() +
        theme(panel.grid=element_blank(), text = element_text(size=14)) +
        geom_point(aes(colour=genotype), size=2) +        
        geom_smooth(method=lm, formula = y ~ poly(x,3), se=FALSE) +
        #facet_grid(. ~ genotype) +
        xlab(label = "Etoposide (log10 µM)") +
        scale_color_manual(values=c("#000000","#808000"))

library(Cairo)

cairo_pdf("FigureS5M.pdf", width = 5, height = 4, family = "Arial")

ggplot(dataset, aes(x=Etoposide, y=NormCounts2)) + 
        theme_bw() +
        theme(panel.grid.major=element_blank(), panel.grid.minor=element_blank(), 
              axis.line = element_line(colour = "black"), text = element_text(size=14),
              panel.border = element_blank(), panel.background = element_blank()) +
        geom_point(aes(colour = genotype)) +
        geom_smooth(method=lm, formula = y ~ poly(x,2), se=TRUE, aes(colour = genotype), fill='#CCCCCC') +
        #facet_grid(. ~ genotype) +
        xlab(label = "Etoposide (log10 µM)") +
        ylab(label = "Normalized Counts") +
        scale_color_manual(values=c("#000000","#808000"))

dev.off()
## quartz_off_screen 
##                 2

Models

library(MASS)
library(DHARMa)
library(lme4)
library(lmerTest)
library(bbmle)

Linear formula

fit1 <- lm(Counts ~ Experiment + Etoposide*genotype, data = dataset)
print(summary(fit1))
## 
## Call:
## lm(formula = Counts ~ Experiment + Etoposide * genotype, data = dataset)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -293.49  -76.90  -10.27  103.09  278.09 
## 
## Coefficients:
##                            Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                 1809.04      99.55  18.173 5.00e-13 ***
## Experimentexp2              -475.12      83.20  -5.710 2.05e-05 ***
## Experimentexp3              -312.50      83.20  -3.756  0.00145 ** 
## Etoposide                   -926.40      93.98  -9.857 1.11e-08 ***
## genotypeYFP-ALC1             221.58     123.30   1.797  0.08913 .  
## Etoposide:genotypeYFP-ALC1   -10.55     132.91  -0.079  0.93763    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 166.4 on 18 degrees of freedom
## Multiple R-squared:  0.9303, Adjusted R-squared:  0.9109 
## F-statistic: 48.02 on 5 and 18 DF,  p-value: 8.728e-10
cat("AIC: ", AIC(fit1))
## AIC:  320.6975
simres <- simulateResiduals(fittedModel = fit1)
plot(simres)

fit2 <- lm(NormCounts ~ Etoposide*genotype, data = dataset)
print(summary(fit2))
## 
## Call:
## lm(formula = NormCounts ~ Etoposide * genotype, data = dataset)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.21723 -0.11520 -0.02746  0.08389  0.42203 
## 
## Coefficients:
##                            Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                 1.88991    0.08655  21.835 2.01e-15 ***
## Etoposide                  -1.14941    0.09330 -12.320 8.53e-11 ***
## genotypeYFP-ALC1           -0.18519    0.12241  -1.513   0.1460    
## Etoposide:genotypeYFP-ALC1  0.23919    0.13194   1.813   0.0849 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1652 on 20 degrees of freedom
## Multiple R-squared:  0.9251, Adjusted R-squared:  0.9138 
## F-statistic: 82.32 on 3 and 20 DF,  p-value: 1.989e-11
cat("AIC: ", AIC(fit2))
## AIC:  -12.69626
simres <- simulateResiduals(fittedModel = fit2)
plot(simres)

fit3 <- lm(NormCounts2 ~ Etoposide*genotype, data = dataset)
print(summary(fit3))
## 
## Call:
## lm(formula = NormCounts2 ~ Etoposide * genotype, data = dataset)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.11627 -0.06009 -0.01697  0.05185  0.22015 
## 
## Coefficients:
##                            Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                 0.98587    0.04815  20.475 6.89e-15 ***
## Etoposide                  -0.59959    0.05190 -11.553 2.65e-10 ***
## genotypeYFP-ALC1            0.06774    0.06809   0.995    0.332    
## Etoposide:genotypeYFP-ALC1  0.03702    0.07340   0.504    0.620    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.0919 on 20 degrees of freedom
## Multiple R-squared:  0.9279, Adjusted R-squared:  0.9171 
## F-statistic: 85.86 on 3 and 20 DF,  p-value: 1.349e-11
cat("AIC: ", AIC(fit3))
## AIC:  -40.84699
simres <- simulateResiduals(fittedModel = fit3)
plot(simres)

fit4 <- lmer(Counts ~ Etoposide*genotype + (1|UID), data = dataset)
print(summary(fit4))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Counts ~ Etoposide * genotype + (1 | UID)
##    Data: dataset
## 
## REML criterion at convergence: 275.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.6176 -0.4058  0.1154  0.5969  1.3234 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  UID      (Intercept) 58319    241.5   
##  Residual             24913    157.8   
## Number of obs: 24, groups:  UID, 6
## 
## Fixed effects:
##                            Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)                1546.494    162.108    5.895   9.540 8.41e-05 ***
## Etoposide                  -926.399     89.141   16.000 -10.392 1.60e-08 ***
## genotypeYFP-ALC1            221.582    229.255    5.895   0.967    0.372    
## Etoposide:genotypeYFP-ALC1  -10.547    126.065   16.000  -0.084    0.934    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) Etopsd gYFP-A
## Etoposide   -0.426              
## gntYFP-ALC1 -0.707  0.301       
## Et:YFP-ALC1  0.301 -0.707 -0.426
cat("AIC: ", AIC(fit4))
## AIC:  287.829
simres <- simulateResiduals(fittedModel = fit4)
plot(simres)

Quadratic formula

fit5 <- lm(Counts ~ Experiment + poly(Etoposide,2)*genotype, data = dataset)
print(summary(fit5))
## 
## Call:
## lm(formula = Counts ~ Experiment + poly(Etoposide, 2) * genotype, 
##     data = dataset)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -217.82  -93.04   10.82   49.77  333.47 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           1091.79      62.69  17.417 7.98e-12 ***
## Experimentexp2                        -475.12      76.77  -6.189 1.30e-05 ***
## Experimentexp3                        -312.50      76.77  -4.070  0.00089 ***
## poly(Etoposide, 2)1                  -2319.79     217.15 -10.683 1.09e-08 ***
## poly(Etoposide, 2)2                    115.27     217.15   0.531  0.60283    
## genotypeYFP-ALC1                       213.42      62.69   3.405  0.00363 ** 
## poly(Etoposide, 2)1:genotypeYFP-ALC1   -26.41     307.09  -0.086  0.93253    
## poly(Etoposide, 2)2:genotypeYFP-ALC1  -593.95     307.09  -1.934  0.07099 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 153.5 on 16 degrees of freedom
## Multiple R-squared:  0.9472, Adjusted R-squared:  0.9241 
## F-statistic: 41.02 on 7 and 16 DF,  p-value: 4.74e-09
cat("AIC: ", AIC(fit5))
## AIC:  318.0103
simres <- simulateResiduals(fittedModel = fit5)
plot(simres)

fit6 <- lm(NormCounts ~ poly(Etoposide,2)*genotype, data = dataset)
print(summary(fit6))
## 
## Call:
## lm(formula = NormCounts ~ poly(Etoposide, 2) * genotype, data = dataset)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.24209 -0.10493  0.01043  0.05464  0.39717 
## 
## Coefficients:
##                                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           1.000e+00  4.364e-02  22.916 9.08e-15 ***
## poly(Etoposide, 2)1                  -2.878e+00  2.138e-01 -13.464 7.75e-11 ***
## poly(Etoposide, 2)2                   1.486e-01  2.138e-01   0.695   0.4958    
## genotypeYFP-ALC1                     -2.949e-16  6.171e-02   0.000   1.0000    
## poly(Etoposide, 2)1:genotypeYFP-ALC1  5.989e-01  3.023e-01   1.981   0.0631 .  
## poly(Etoposide, 2)2:genotypeYFP-ALC1 -6.455e-01  3.023e-01  -2.135   0.0468 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1512 on 18 degrees of freedom
## Multiple R-squared:  0.9435, Adjusted R-squared:  0.9279 
## F-statistic: 60.17 on 5 and 18 DF,  p-value: 1.329e-10
cat("AIC: ", AIC(fit6))
## AIC:  -15.48591
simres <- simulateResiduals(fittedModel = fit6)
plot(simres)

fit7 <- lm(NormCounts2 ~ poly(Etoposide,2)*genotype, data = dataset)
print(summary(fit7))
## 
## Call:
## lm(formula = NormCounts2 ~ poly(Etoposide, 2) * genotype, data = dataset)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.126286 -0.059658  0.006449  0.033773  0.207182 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           0.52165    0.02345  22.249 1.52e-14 ***
## poly(Etoposide, 2)1                  -1.50143    0.11486 -13.072 1.26e-10 ***
## poly(Etoposide, 2)2                   0.07752    0.11486   0.675  0.50832    
## genotypeYFP-ALC1                      0.09641    0.03316   2.908  0.00939 ** 
## poly(Etoposide, 2)1:genotypeYFP-ALC1  0.09270    0.16244   0.571  0.57527    
## poly(Etoposide, 2)2:genotypeYFP-ALC1 -0.38462    0.16244  -2.368  0.02930 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.08122 on 18 degrees of freedom
## Multiple R-squared:  0.9493, Adjusted R-squared:  0.9353 
## F-statistic: 67.47 on 5 and 18 DF,  p-value: 5.051e-11
cat("AIC: ", AIC(fit7))
## AIC:  -45.30395
simres <- simulateResiduals(fittedModel = fit7)
plot(simres)

fit8 <- lmer(Counts ~ poly(Etoposide,2)*genotype + (1|UID), data = dataset)
print(summary(fit8))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Counts ~ poly(Etoposide, 2) * genotype + (1 | UID)
##    Data: dataset
## 
## REML criterion at convergence: 241.6
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.55307 -0.47141  0.02687  0.39898  2.00520 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  UID      (Intercept) 59594    244.1   
##  Residual             19814    140.8   
## Number of obs: 24, groups:  UID, 6
## 
## Fixed effects:
##                                      Estimate Std. Error       df t value
## (Intercept)                            829.25     146.68     4.00   5.653
## poly(Etoposide, 2)1                  -2319.79     199.07    14.00 -11.653
## poly(Etoposide, 2)2                    115.27     199.07    14.00   0.579
## genotypeYFP-ALC1                       213.42     207.44     4.00   1.029
## poly(Etoposide, 2)1:genotypeYFP-ALC1   -26.41     281.53    14.00  -0.094
## poly(Etoposide, 2)2:genotypeYFP-ALC1  -593.95     281.53    14.00  -2.110
##                                      Pr(>|t|)    
## (Intercept)                           0.00482 ** 
## poly(Etoposide, 2)1                  1.36e-08 ***
## poly(Etoposide, 2)2                   0.57177    
## genotypeYFP-ALC1                      0.36171    
## poly(Etoposide, 2)1:genotypeYFP-ALC1  0.92659    
## poly(Etoposide, 2)2:genotypeYFP-ALC1  0.05336 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) pl(E,2)1 pl(E,2)2 gYFP-A p(E,2)1:
## ply(Etp,2)1  0.000                                  
## ply(Etp,2)2  0.000  0.000                           
## gntYFP-ALC1 -0.707  0.000    0.000                  
## p(E,2)1:YFP  0.000 -0.707    0.000    0.000         
## p(E,2)2:YFP  0.000  0.000   -0.707    0.000  0.000
cat("AIC: ", AIC(fit8))
## AIC:  257.643
simres <- simulateResiduals(fittedModel = fit8)
plot(simres)

Cubic formula

fit9 <- lm(Counts ~ Experiment + poly(Etoposide,3)*genotype, data = dataset)
print(summary(fit9))
## 
## Call:
## lm(formula = Counts ~ Experiment + poly(Etoposide, 3) * genotype, 
##     data = dataset)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -219.38  -86.54    9.10   58.18  335.46 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           1091.79      66.81  16.341 1.63e-10 ***
## Experimentexp2                        -475.12      81.83  -5.806 4.55e-05 ***
## Experimentexp3                        -312.50      81.83  -3.819  0.00188 ** 
## poly(Etoposide, 3)1                  -2319.79     231.45 -10.023 9.08e-08 ***
## poly(Etoposide, 3)2                    115.27     231.45   0.498  0.62619    
## poly(Etoposide, 3)3                    -41.35     231.45  -0.179  0.86075    
## genotypeYFP-ALC1                       213.42      66.81   3.194  0.00649 ** 
## poly(Etoposide, 3)1:genotypeYFP-ALC1   -26.41     327.32  -0.081  0.93683    
## poly(Etoposide, 3)2:genotypeYFP-ALC1  -593.95     327.32  -1.815  0.09106 .  
## poly(Etoposide, 3)3:genotypeYFP-ALC1    94.25     327.32   0.288  0.77760    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 163.7 on 14 degrees of freedom
## Multiple R-squared:  0.9475, Adjusted R-squared:  0.9138 
## F-statistic:  28.1 on 9 and 14 DF,  p-value: 1.883e-07
cat("AIC: ", AIC(fit9))
## AIC:  321.8665
simres <- simulateResiduals(fittedModel = fit9)
plot(simres)

fit10 <- lm(NormCounts ~ poly(Etoposide,3)*genotype, data = dataset)
print(summary(fit10))
## 
## Call:
## lm(formula = NormCounts ~ poly(Etoposide, 3) * genotype, data = dataset)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.24432 -0.09756  0.01349  0.04892  0.39494 
## 
## Coefficients:
##                                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           1.000e+00  4.592e-02  21.775 2.57e-13 ***
## poly(Etoposide, 3)1                  -2.878e+00  2.250e-01 -12.793 8.10e-10 ***
## poly(Etoposide, 3)2                   1.486e-01  2.250e-01   0.661   0.5183    
## poly(Etoposide, 3)3                  -5.937e-02  2.250e-01  -0.264   0.7952    
## genotypeYFP-ALC1                     -2.855e-16  6.495e-02   0.000   1.0000    
## poly(Etoposide, 3)1:genotypeYFP-ALC1  5.989e-01  3.182e-01   1.882   0.0781 .  
## poly(Etoposide, 3)2:genotypeYFP-ALC1 -6.455e-01  3.182e-01  -2.029   0.0595 .  
## poly(Etoposide, 3)3:genotypeYFP-ALC1  1.554e-01  3.182e-01   0.488   0.6319    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1591 on 16 degrees of freedom
## Multiple R-squared:  0.9444, Adjusted R-squared:  0.9201 
## F-statistic: 38.84 on 7 and 16 DF,  p-value: 7.127e-09
cat("AIC: ", AIC(fit10))
## AIC:  -11.86055
simres <- simulateResiduals(fittedModel = fit10)
plot(simres)

fit11 <- lm(NormCounts2 ~ poly(Etoposide,3)*genotype, data = dataset)
print(summary(fit11))
## 
## Call:
## lm(formula = NormCounts2 ~ poly(Etoposide, 3) * genotype, data = dataset)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.127450 -0.053301  0.007903  0.030238  0.206018 
## 
## Coefficients:
##                                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                           0.52165    0.02463  21.177 3.96e-13 ***
## poly(Etoposide, 3)1                  -1.50143    0.12068 -12.442 1.22e-09 ***
## poly(Etoposide, 3)2                   0.07752    0.12068   0.642   0.5297    
## poly(Etoposide, 3)3                  -0.03097    0.12068  -0.257   0.8007    
## genotypeYFP-ALC1                      0.09641    0.03484   2.767   0.0137 *  
## poly(Etoposide, 3)1:genotypeYFP-ALC1  0.09270    0.17066   0.543   0.5945    
## poly(Etoposide, 3)2:genotypeYFP-ALC1 -0.38462    0.17066  -2.254   0.0386 *  
## poly(Etoposide, 3)3:genotypeYFP-ALC1  0.09031    0.17066   0.529   0.6040    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.08533 on 16 degrees of freedom
## Multiple R-squared:  0.9503, Adjusted R-squared:  0.9286 
## F-statistic:  43.7 on 7 and 16 DF,  p-value: 2.953e-09
cat("AIC: ", AIC(fit11))
## AIC:  -41.76101
simres <- simulateResiduals(fittedModel = fit11)
plot(simres)

fit12 <- lmer(Counts ~ poly(Etoposide,3)*genotype + (1|UID), data = dataset)
print(summary(fit12))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Counts ~ poly(Etoposide, 3) * genotype + (1 | UID)
##    Data: dataset
## 
## REML criterion at convergence: 216.5
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -1.45825 -0.39018  0.07723  0.35734  1.90425 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  UID      (Intercept) 58815    242.5   
##  Residual             22929    151.4   
## Number of obs: 24, groups:  UID, 6
## 
## Fixed effects:
##                                      Estimate Std. Error       df t value
## (Intercept)                            829.25     146.68     4.00   5.653
## poly(Etoposide, 3)1                  -2319.79     214.14    12.00 -10.833
## poly(Etoposide, 3)2                    115.27     214.14    12.00   0.538
## poly(Etoposide, 3)3                    -41.35     214.14    12.00  -0.193
## genotypeYFP-ALC1                       213.42     207.44     4.00   1.029
## poly(Etoposide, 3)1:genotypeYFP-ALC1   -26.41     302.85    12.00  -0.087
## poly(Etoposide, 3)2:genotypeYFP-ALC1  -593.95     302.85    12.00  -1.961
## poly(Etoposide, 3)3:genotypeYFP-ALC1    94.25     302.85    12.00   0.311
##                                      Pr(>|t|)    
## (Intercept)                           0.00482 ** 
## poly(Etoposide, 3)1                   1.5e-07 ***
## poly(Etoposide, 3)2                   0.60023    
## poly(Etoposide, 3)3                   0.85010    
## genotypeYFP-ALC1                      0.36171    
## poly(Etoposide, 3)1:genotypeYFP-ALC1  0.93194    
## poly(Etoposide, 3)2:genotypeYFP-ALC1  0.07347 .  
## poly(Etoposide, 3)3:genotypeYFP-ALC1  0.76098    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) pl(E,3)1 pl(E,3)2 pl(E,3)3 gYFP-A p(E,3)1: p(E,3)2:
## ply(Etp,3)1  0.000                                                    
## ply(Etp,3)2  0.000  0.000                                             
## ply(Etp,3)3  0.000  0.000    0.000                                    
## gntYFP-ALC1 -0.707  0.000    0.000    0.000                           
## p(E,3)1:YFP  0.000 -0.707    0.000    0.000    0.000                  
## p(E,3)2:YFP  0.000  0.000   -0.707    0.000    0.000  0.000           
## p(E,3)3:YFP  0.000  0.000    0.000   -0.707    0.000  0.000    0.000
cat("AIC: ", AIC(fit12))
## AIC:  236.5446
simres <- simulateResiduals(fittedModel = fit12)
plot(simres)

Compare Results

ICtab(fit1,fit2,fit3,fit4,
      fit5,fit6,fit7,fit8,
      fit9,fit10,fit11,fit12,
      base=T)
##       AIC   dAIC  df
## fit7  -45.3   0.0 7 
## fit11 -41.8   3.5 9 
## fit3  -40.8   4.5 5 
## fit6  -15.5  29.8 7 
## fit2  -12.7  32.6 5 
## fit10 -11.9  33.4 9 
## fit12 236.5 281.8 10
## fit8  257.6 302.9 8 
## fit4  287.8 333.1 6 
## fit5  318.0 363.3 9 
## fit1  320.7 366.0 7 
## fit9  321.9 367.2 11

Final Result

fit <- fit7

output <- coef(summary(fit))
output <- output[grep("Etoposide", rownames(output)),]


rownames(output) <- gsub("poly\\(|, [1-3]\\)","", rownames(output) )
rownames(output) <- gsub("genotype",  paste0(" ",levels(dataset$genotype)[1], " vs. "), rownames(output))
rownames(output)[!(grepl("vs", rownames(output)))] <- paste(rownames(output)[!(grepl("vs", rownames(output)))], levels(dataset$genotype)[1],  sep = " in " )


# suggested result table
kable(output, row.names = T)
Estimate Std. Error t value Pr(>|t|)
Etoposide1 in WT -1.5014286 0.1148621 -13.0715746 0.0000000
Etoposide2 in WT 0.0775204 0.1148621 0.6748998 0.5083165
Etoposide1: WT vs. YFP-ALC1 0.0927016 0.1624396 0.5706838 0.5752699
Etoposide2: WT vs. YFP-ALC1 -0.3846220 0.1624396 -2.3677853 0.0292974
write.table(output, file = "FigureS5M_Stats.txt", quote = F, sep = "\t", row.names = T, col.names = NA)

Anova

fit7a <- lm(NormCounts2 ~ poly(Etoposide,2)*genotype, data = dataset)
fit7b <- lm(NormCounts2 ~ poly(Etoposide,2)+genotype, data = dataset)

# anova table
anova(fit7a, fit7b)
## Analysis of Variance Table
## 
## Model 1: NormCounts2 ~ poly(Etoposide, 2) * genotype
## Model 2: NormCounts2 ~ poly(Etoposide, 2) + genotype
##   Res.Df     RSS Df Sum of Sq     F  Pr(>F)  
## 1     18 0.11874                             
## 2     20 0.15787 -2 -0.039132 2.966 0.07702 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1